<template>
    <div>
        <h1>添加11111</h1>
        <tr>
            <td>姓名</td>
            <td>  <input type="text" v-model="state.mname"></td>      
        </tr>
        <tr>
            <td>电话</td>
            <td>  <input type="text" v-model="state.mphone"></td>      
        </tr>
        <tr>
            <td>生日</td>
            <td>  <input type="date" v-model="state.mdates"></td>      
        </tr>
        <tr>
            <td>身份证</td>
            <td>  <input type="text" v-model="state.msfz"></td>      
        </tr>
        <tr>
            <td>日期</td>
            <td>  <input type="date" v-model="state.mdated"></td>      
        </tr>
        <tr>
            <td>卡号</td>
            <td>  <input type="text" v-model="state.mkahao"></td>      
        </tr>
        <tr>
            <td>类型</td>
            <td>  <input type="text" v-model="state.mleix"></td>      
        </tr>
        <tr>
            <td><input type="button"  value="添加" @click="tianjia"></td>
            <td></td>      
        </tr>
    </div>
</template>

<script setup lang="ts">

import { reactive,toRefs, onMounted} from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import axios from 'axios'
 const route = useRoute()
 const router = useRouter()

 const data = reactive({
    
    state:{
        mname:'',
        mphone:'',
        mdates:'',
        msfz:'',
        mdated:'',
        mkahao:'',
        mleix:'',
     
    }
 })

 const {state} = toRefs(data)

const tianjia = ()=>{

    axios({
        url:'https://localhost:7277/api/Member/AddMember',
        method:'post',
        data:state.value
    })
    .then((res)=>{
        console.log(res)
        if(res.data.data > 0){
            alert('成功')
            //router.push('show')
        }
        else{
            alert('失败')
        }
    })
    .catch((err)=>{
        console.log(err)
    })
}



</script>

<style scoped>

</style>